﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _025_第二十五章_中介者模式
{
    class UnitedNation
    {
        public List<Country> countries = new List<Country>();

        public void SendMessage(string content, Country origin, Country target)
        {
            if(!countries.Exists(o => o.Equals(origin)) || !countries.Exists(o => o.Equals(origin)))
            {
                Console.WriteLine("没有找到该对象。");
                return;
            }

            target.ReceiveMessage(content);
        }

        public void Register(Country country)
        {
            countries.Add(country);
        }
    }
}
